3D Visualizations¶
PyPMT offers 3D visualizations as well. For these visualizations, we will once again use bedmachine data (variable named 'ds').
ds = xr.open_dataset(Path('your_dataset.nc'))
x = ds['x'].values
y = ds['y'].values
thick = ds['thickness'].values
thick2d = thick.reshape(13333, 13333)
surface = ds['surface'].values
surf2d = surface.reshape(13333, 13333)
surf2d = surf2d.astype('float')
surf2d[thick2d <= 0] = np.nan
bed = ds['bed'].values
bed2d = bed.reshape(13333, 13333)
Suppose we want to plot the bed elevation of Antarctica's Thwaites Glacier. To do so, we can call the following:
lat, lon = scar_loc('thwaites glacier')
plot_3ps(lat, lon, bed, x, y, cmap = 'viridis', z_scale = 0.8)
When the cmap (colormap) parameter is used, a colorbar will also be visible. If this parameter is not used, the plot will feature a solid color and there will not be a colorbar. It is worth noting that our other bedmachine variables loaded above (surface, thick, mask) can also be plotted instead of bed elevation.
Additionally, if you call "%matplotlib notebook" before the previous code, you can rotate the visualization to view it from different angles.
In the following example, we execute the function in a similar fashion, but we set show_grid to False. By doing so, we plot the data without the background grid.
lat, lon = scar_loc('Pine Island Glacier')
plot_3ps(lat, lon, bed, x, y, cmap = 'gist_earth', z_scale = 0.6, show_grid=False)